﻿package mortal.game.view.guildNew
{
    import Message.Game.*;
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.cache.guild.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.ai.*;
    import mortal.game.scene3D.ai.ais.*;
    import mortal.game.utils.*;
    import mortal.game.view.activeTime.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.menu.*;
    import mortal.game.view.guild.buildingPanel.*;
    import mortal.game.view.guild.hintIcon.*;
    import mortal.game.view.guild.otherpanel.*;
    import mortal.game.view.guildNew.WareHourse.*;
    import mortal.game.view.guildNew.data.*;
    import mortal.game.view.guildNew.info.*;
    import mortal.game.view.guildNew.info.data.*;
    import mortal.game.view.guildNew.manor.*;
    import mortal.game.view.guildNew.member.*;
    import mortal.game.view.guildNew.mercenary.*;
    import mortal.game.view.guildNew.other.*;
    import mortal.game.view.guildNew.otherGuildMem.*;
    import mortal.game.view.guildNew.shop.*;
    import mortal.game.view.guildNew.skill.*;
    import mortal.game.view.task.data.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuildNewController extends Controller
    {
        private var _proArr:Array;

        public function GuildNewController()
        {
            this._proArr = [];
            this._proArr = [new GuildNewInfoProcessor(), new GuildNewMemProcessor(), new GuildNewManorProcessor(), new GuildNewShopPorcessor(), new GuildNewWHProcessor(), new GuildNewMercenaryProcessor()];
            return;
        }// end function

        override protected function initView() : IView
        {
            if (!_view)
            {
                _view = new GuildNewModule();
                _view.addEventListener(WindowEvent.SHOW, this.onViewShow);
                _view.addEventListener(WindowEvent.CLOSE, this.onViewHide);
                this.setProcessorView();
            }
            return _view;
        }// end function

        private function setProcessorView() : void
        {
            var _loc_1:int = 0;
            while (_loc_1 < this._proArr.length)
            {
                
                var _loc_2:* = this._proArr[_loc_1];
                _loc_2.this._proArr[_loc_1]["initView"](_view);
                _loc_1++;
            }
            return;
        }// end function

        override public function get view() : IView
        {
            if (cache.guild.selfGuildInfo.selfHasJoinGuild)
            {
                if (_view == null)
                {
                    _view = this.initView();
                }
                return _view;
            }
            else
            {
            }
            return GuildListPanel.instance;
        }// end function

        protected function onViewShow(event:Event) : void
        {
            this.addEves(true);
            var _loc_2:int = 0;
            while (_loc_2 < this._proArr.length)
            {
                
                var _loc_3:* = this._proArr[_loc_2];
                _loc_3.this._proArr[_loc_2]["onViewShow"]();
                _loc_2++;
            }
            return;
        }// end function

        protected function onViewHide(event:Event) : void
        {
            this.addEves(false);
            var _loc_2:int = 0;
            while (_loc_2 < this._proArr.length)
            {
                
                var _loc_3:* = this._proArr[_loc_2];
                _loc_3.this._proArr[_loc_2]["onViewHide"]();
                _loc_2++;
            }
            return;
        }// end function

        private function addEves(param1:Boolean) : void
        {
            EventUtil.addSelfEvent(GuildNewLocalEvent.ModuleChangeTab, this.onTabChange, param1);
            EventUtil.addNetEvent(ServerCommand.GUILD_INFO_UPDATE, this.guildUpdate, param1);
            Dispatcher.addEventListener(EventName.GuildGetActivityReward, this.onGetActivityReward);
            EventUtil.addNetEvent(ServerCommand.GUILD_MEMBERS_UPDATE, this.guildMemberListUpdate, param1);
            EventUtil.addNetEvent(ServerCommand.SkillAdd, this.skillUpdateHandler, param1);
            EventUtil.addNetEvent(ServerCommand.SkillListUpdate, this.skillUpdateHandler, param1);
            EventUtil.addNetEvent(ServerCommand.SkillUpdate, this.skillUpdateHandler, param1);
            EventUtil.addNetEvent(ServerCommand.SkillUpgrade, this.skillUpdateHandler, param1);
            EventUtil.addSelfEvent(GuildNewLocalEvent.GuildNewSkillResourceAdd, this.skillResourceAdd, param1);
            return;
        }// end function

        private function activesNoticHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SClientActive;
            this.showIconByActive(_loc_2);
            return;
        }// end function

        private function showIconByActive(param1:SClientActive) : void
        {
            var _loc_2:int = 0;
            if (param1.type != EActiveType._EActiveTypeGuildBoss)
            {
                return;
            }
            var _loc_3:* = Math.ceil((param1.startDt.time - ClockManager.instance.nowDate.time) / 1000);
            if (_loc_3 <= 0)
            {
                return;
            }
            GuildBossIcon.instance.show();
            GuildBossIcon.instance.setShowState(param1.startDt, 1);
            return;
        }// end function

        private function activesStarHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SClientActive;
            if (_loc_2.type != EActiveType._EActiveTypeGuildBoss)
            {
                return;
            }
            var _loc_3:* = Math.ceil((_loc_2.endDt.time - ClockManager.instance.nowDate.time) / 1000);
            if (_loc_3 <= 0)
            {
                return;
            }
            GuildBossIcon.instance.show();
            GuildBossIcon.instance.setShowState(_loc_2.endDt, 2);
            return;
        }// end function

        private function activesEndHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SClientActive;
            if (_loc_2.type != EActiveType._EActiveTypeGuildBoss)
            {
                return;
            }
            GuildBossIcon.instance.stopEffect();
            GuildBossIcon.instance.hide();
            return;
        }// end function

        private function checkActive() : void
        {
            var _loc_1:* = ActiveTimeUtil.getSClientActive(EActiveType._EActiveTypeGuildBoss);
            if (_loc_1)
            {
                GuildBossIcon.instance.show();
                GuildBossIcon.instance.setShowState(_loc_1.endDt, 2);
            }
            return;
        }// end function

        private function onGuildOpen(event:DataEvent) : void
        {
            var _loc_2:String = null;
            if (!GameController.autoGuide.hasShowModule(ModuleType.Guild))
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71656));
                return;
            }
            if (this.view.isHide)
            {
                this.view.show();
                _loc_2 = String(event.data);
                if (_view && _view.isHide == false && _view is GuildNewModule)
                {
                    (_view as GuildNewModule).selectedIndex = _loc_2;
                }
            }
            else
            {
                this.view.hide();
            }
            return;
        }// end function

        private function openAndTweenCenterWin(event:DataEvent) : void
        {
            if (!GameController.autoGuide.hasShowModule(ModuleType.Guild))
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71657));
                return;
            }
            var _loc_2:* = event.data.view;
            var _loc_3:* = String(event.data.index);
            if (!isViewShow)
            {
                LayerManager.windowLayer.tweenCenterWindow(this.view, _loc_2);
            }
            if (_view && _view.isHide == false && _view is GuildNewModule)
            {
                (_view as GuildNewModule).selectedIndex = _loc_3;
            }
            return;
        }// end function

        private function onGuildClose(event:DataEvent) : void
        {
            if (_view)
            {
                this.view.hide();
            }
            return;
        }// end function

        private function onTabChange(event:DataEvent) : void
        {
            var _loc_2:* = String(event.data);
            if (_view && _view.isHide == false)
            {
                (_view as GuildNewModule).selectedIndex = _loc_2;
            }
            return;
        }// end function

        private function onGuildActivityShow(event:DataEvent) : void
        {
            if (cache.guild.selfGuildInfo.baseInfo)
            {
                if (GuildBuildingConfig.instance.getInfoByBuildingType(cache.guild.selfGuildInfo.baseInfo.level, EGuildStructureType._EGuildAltar).structureLevel <= 0)
                {
                    MsgManager.showRollTipsMsg("" + Language.getString(71658));
                    return;
                }
                GuildNewCopyPanel.instance.popUp();
            }
            else
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71659));
            }
            return;
        }// end function

        private function guildUpdate(event:DataEvent) : void
        {
            if (_view != null && _view is GuildNewModule)
            {
                (_view as GuildNewModule).update();
            }
            return;
        }// end function

        private function onShowChangeNamePanel(event:DataEvent) : void
        {
            if (GuildNInfoUtil.canShowChangeBtn())
            {
                GuildNewInfoChangeName.instance.show();
            }
            else
            {
                MsgManager.showRollTipsMsg(Language.getString(71697));
            }
            return;
        }// end function

        override protected function initServer() : void
        {
            EventUtil.addSelfEvent(EventName.GuildNewOpenChangeName, this.onShowChangeNamePanel, true);
            Dispatcher.addEventListener(EventName.ActiveNotic, this.activesNoticHandler);
            Dispatcher.addEventListener(EventName.ActiveStart, this.activesStarHandler);
            Dispatcher.addEventListener(EventName.ActiveEnd, this.activesEndHandler);
            EventUtil.addSelfEvent(EventName.GuildOpen, this.onGuildOpen, true);
            EventUtil.addSelfEvent(EventName.GuildOpenAndTweenCenterWin, this.openAndTweenCenterWin, true);
            EventUtil.addSelfEvent(EventName.GuildClose, this.onGuildClose, true);
            EventUtil.addSelfEvent(EventName.GuildActivityShow, this.onGuildActivityShow, true);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_CREATE, this.createGuildResponse);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_DISBAND, this.disbandGuildResponse);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_EXIT, this.exitGuildResponse);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_APPLY_LIST_UPDATE, this.applyListUpdate);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_INVITE, this.inviteResponse);
            NetDispatcher.addCmdListener(ServerCommand.GuildInviteCreate, this.onGuildInviteCreate);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_IMPEACH, this.impeachResponse);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_NEW_MEMBER_ADD, this.newMemberAdd);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_SELF_JION_SUCCESS, this.selfJionSuccess);
            NetDispatcher.addCmdListener(ServerCommand.GuildPositionModify, this.selfPositionModify);
            NetDispatcher.addCmdListener(ServerCommand.GuildWareHouseDataUpdate, this.wareHouseDataUpdate);
            NetDispatcher.addCmdListener(ServerCommand.GuildWareHouseMyApplysUpdate, this.WareHouseMyApplysUpdate);
            NetDispatcher.addCmdListener(ServerCommand.GuildShopGetItem, this.updateGuildShopItem);
            NetDispatcher.addCmdListener(ServerCommand.GuildCopyOpen, this.onGuildCopyOpen);
            NetDispatcher.addCmdListener(ServerCommand.GuildCopyClose, this.onGuildCopyClose);
            NetDispatcher.addCmdListener(ServerCommand.GuildActivityUpdate, this.onGuildActivityUpdate);
            NetDispatcher.addCmdListener(ServerCommand.GuildMailSendSuccess, this.onGuildMailSendSuccess);
            NetDispatcher.addCmdListener(ServerCommand.GuildApplyConditionUpdate, this.onGuildApplyConditionUpdate);
            NetDispatcher.addCmdListener(ServerCommand.GUILD_WARN_LIST_UPDATE, this.onGuildWarnListUpdate);
            NetDispatcher.addCmdListener(ServerCommand.TaskGetSucess, this.onTaskGetSucess);
            Dispatcher.addEventListener(EventName.GUILD_INFO_GET, this.guildInfoGet);
            Dispatcher.addEventListener(EventName.GuildShopGetItem, this.guildShopGetItem);
            Dispatcher.addEventListener(EventName.GUILD_CREATE, this.createGuildRequest);
            Dispatcher.addEventListener(EventName.GUILD_DISBAND, this.disbandGuildRequest);
            Dispatcher.addEventListener(EventName.GUILD_EXIT, this.exitGuildRequest);
            Dispatcher.addEventListener(EventName.GUILD_LIST_GET, this.getGuildList);
            Dispatcher.addEventListener(EventName.GUILD_APPLY_LIST_GET, this.getApplyList);
            Dispatcher.addEventListener(EventName.GUILD_APPLY, this.apply);
            Dispatcher.addEventListener(EventName.GUILD_APPLY_BY_ROLE, this.applyByRole);
            Dispatcher.addEventListener(EventName.GUILD_DEAL_APPLY, this.dealApply);
            Dispatcher.addEventListener(EventName.GUILD_INVITE, this.inviteRequest);
            Dispatcher.addEventListener(EventName.GUILD_DEAL_INVITE, this.dealInvite);
            Dispatcher.addEventListener(EventName.GUILD_CHANGE_QQYY, this.changeGuildQQYY);
            Dispatcher.addEventListener(EventName.GUILD_POSITION_OPRATE, this.oprateGuildPostion);
            Dispatcher.addEventListener(EventName.GUILD_IMPEACH_LEADER, this.impeachLeader);
            Dispatcher.addEventListener(EventName.GUILD_ANTIIMPEACH, this.antiimpeach);
            Dispatcher.addEventListener(EventName.GUILD_LEVEL_UP, this.levelUpGuild);
            Dispatcher.addEventListener(EventName.GUILD_KICK_OUT_MEMEBER, this.kickOutMember);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_oper, this.wareHouseOprate);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_getData, this.wareHouseGetData);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_itemMenuClick, this.wareHouseItemMenuClick);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_applyRequst, this.wareHouseApplyRequst);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_getAllApplyList, this.wareHouseGetAllApplyList);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_getMyApplyList, this.wareHouseGetMyApplyList);
            Dispatcher.addEventListener(EventName.Guild_wareHouse_applyCancel, this.wareHouseApplyCancel);
            Dispatcher.addEventListener(EventName.GuildDonateResourceShow, this.donateResourceShow);
            Dispatcher.addEventListener(EventName.Guild_copy_open, this.openGuildCopyRequest);
            Dispatcher.addEventListener(EventName.Guild_copy_enter, this.enterGuildCopyRequest);
            Dispatcher.addEventListener(EventName.Guild_building_fix, this.fixBuildingRequest);
            Dispatcher.addEventListener(EventName.Guild_building_stopFix, this.stopFixRequest);
            Dispatcher.addEventListener(EventName.Guild_school_learn, this.schoolLearnSkill);
            Dispatcher.addEventListener(EventName.Guild_school_open, this.schoolOpen);
            Dispatcher.addEventListener(EventName.Guild_warnCondition_set, this.setWarnConditionRequest);
            Dispatcher.addEventListener(EventName.Guild_activity_requst, this.getActivityRequest);
            Dispatcher.addEventListener(EventName.Guild_mail_send, this.sendGuildMail);
            Dispatcher.addEventListener(EventName.GUILD_SET_APPLY_CONDITION, this.setApplyCondition);
            Dispatcher.addEventListener(EventName.GUILD_CAMP_LEVEL_UP, this.upgradeCampRequest);
            Dispatcher.addEventListener(EventName.Guild_update_findtalentpanel, this.UpdateFindtalentPanel);
            Dispatcher.addEventListener(EventName.Guild_find_talent, this.findtalent);
            Dispatcher.addEventListener(EventName.GuildGetTreeBuff, this.onGuildGetTreeBuff);
            Dispatcher.addEventListener(EventName.GuildOpen, this.onGuildOpen);
            Dispatcher.addEventListener(EventName.GuildTaskDoubleRewardViewShow, this.onGuildTaskDoubleRewardViewShow);
            NetDispatcher.addCmdListener(ServerCommand.GuildSelfGardenUpdate, this.updateGardenInfo);
            Dispatcher.addEventListener(EventName.GuildGotoGarden, this.gotoGardenHd);
            EventUtil.addSelfEvent(GuildNewLocalEvent.GuildNewGetOtherGuildList, this.onGetOtherGuildMen, true);
            EventUtil.addSelfEvent(EventName.Guild_update_findtalentpanel, this.onOtherMemInfoBack, true);
            return;
        }// end function

        private function skillUpdateHandler(param1:Object) : void
        {
            if (_view != null && isViewShow && _view is GuildNewModule)
            {
                (_view as GuildNewModule).update(GuildNewSkillPanel);
            }
            return;
        }// end function

        private function skillResourceAdd(param1:Object) : void
        {
            if (_view != null && isViewShow && _view is GuildNewModule)
            {
                (_view as GuildNewModule).updateSkillLabel();
            }
            return;
        }// end function

        private function guildInfoGet(event:DataEvent) : void
        {
            GameProxy.guild.getGuildInfo(cache.guild.selfGuildInfo.guildID);
            return;
        }// end function

        private function createGuildRequest(event:DataEvent) : void
        {
            var _loc_3:Boolean = false;
            if (cache.guild.selfGuildInfo.selfHasJoinGuild)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71660));
                return;
            }
            if (cache.role.roleInfo.level < GuildConst.CreateGuildRequireLevel)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71661));
                return;
            }
            var _loc_2:* = event.data;
            if (_loc_2.type == ECreate._ECreateMoney)
            {
                _loc_3 = cache.role.enoughMoney(EPriceUnit._EPriceUnitGoldBind, GuildConst.CreateGuildRequireCostGold);
                if (!_loc_3)
                {
                    MsgManager.showRollTipsMsg("" + Language.getString(71662));
                    return;
                }
            }
            GameProxy.guild.createGuild(_loc_2.type, _loc_2.name, _loc_2.purpose);
            return;
        }// end function

        private function createGuildResponse(param1:Object = null) : void
        {
            if (GuildListPanel.hasInstance && !GuildListPanel.instance.isHide)
            {
                GuildListPanel.instance.hide();
            }
            GuildCreatePanel.instance.hide();
            this.view.show();
            return;
        }// end function

        private function disbandGuildRequest(event:DataEvent) : void
        {
            var e:* = event;
            var guildInfo:* = Cache.instance.guild.selfGuildInfo;
            if (!guildInfo.memberList.length >= GuildConst.CanDisbandGuildMembersLimit)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71663));
                return;
            }
            var disbandCallback:* = function (param1:int) : void
            {
                if (param1 == Alert.OK)
                {
                    GameProxy.guild.disbandGuild();
                }
                return;
            }// end function
            ;
            Alert.show(Language.getStringByParam(71664, guildInfo.baseInfo.guildName), null, Alert.OK | Alert.CANCEL, null, disbandCallback);
            return;
        }// end function

        private function disbandGuildResponse(param1:Object = null) : void
        {
            if (_view != null && _view is GuildNewModule)
            {
                _view.hide();
                _view = null;
            }
            cache.guild.selfGuildInfo.disbandGuild();
            return;
        }// end function

        private function exitGuildRequest(event:DataEvent) : void
        {
            var e:* = event;
            var guildInfo:* = Cache.instance.guild.selfGuildInfo;
            if (guildInfo.selfInfo.position >= EGuildPosition._EGuildPresbyter)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71665));
                return;
            }
            var exitCallback:* = function (param1:int) : void
            {
                if (param1 == Alert.OK)
                {
                    GameProxy.guild.exitGuild();
                }
                return;
            }// end function
            ;
            Alert.show(Language.getStringByParam(71666, guildInfo.baseInfo.guildName), null, Alert.OK | Alert.CANCEL, null, exitCallback);
            return;
        }// end function

        private function exitGuildResponse(param1:Object = null) : void
        {
            if (_view != null && _view is GuildNewModule)
            {
                (_view as GuildNewModule).hide();
                _view = null;
            }
            cache.guild.selfGuildInfo.disbandGuild();
            GuildHintIconMgr.instance.hideAll();
            if (GuildWareHousePanel.hasInstance() && !GuildWareHousePanel.instance.isHide)
            {
                GuildWareHousePanel.instance.hide();
            }
            return;
        }// end function

        private function antiimpeach(event:DataEvent) : void
        {
            GameProxy.guild.antiImpeach();
            return;
        }// end function

        private function impeachLeader(event:DataEvent) : void
        {
            GameProxy.guild.impeachGuildLeader();
            return;
        }// end function

        private function impeachResponse(param1:Object = null) : void
        {
            var _loc_2:* = param1 as SGuildLeaderImpeach;
            GuildImpeachActionIcon.instance.data = _loc_2;
            GuildImpeachActionIcon.instance.show();
            return;
        }// end function

        private function oprateGuildPostion(event:DataEvent) : void
        {
            var _loc_2:* = event.data.targetID;
            var _loc_3:* = event.data.position;
            GameProxy.guild.operationMember(_loc_2, _loc_3);
            return;
        }// end function

        private function kickOutMember(event:DataEvent) : void
        {
            var targetID:int;
            var callback:Function;
            var e:* = event;
            targetID = int(e.data);
            var memberInfo:* = Cache.instance.guild.selfGuildInfo.getMemberById(targetID);
            if (memberInfo == null)
            {
                return;
            }
            if (Cache.instance.guild.selfGuildInfo.selfInfo && Cache.instance.guild.selfGuildInfo.selfInfo.position < memberInfo.position)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71667));
                return;
            }
            if (memberInfo.totalContribution > 0)
            {
                callback = function (param1:int) : void
            {
                if (param1 == Alert.OK)
                {
                    GameProxy.guild.operationMember(targetID, EGuildPosition._EGuildNotMember);
                }
                return;
            }// end function
            ;
                Alert.show(Language.getStringByParam(71668, memberInfo.totalContribution), null, Alert.OK | Alert.CANCEL, null, callback);
            }
            else
            {
                GameProxy.guild.operationMember(targetID, EGuildPosition._EGuildNotMember);
            }
            return;
        }// end function

        private function wareHouseOprate(event:DataEvent) : void
        {
            GameProxy.guild.guildWarehouseOper(event.data.oper, event.data.item, event.data.oprMoney);
            return;
        }// end function

        private function wareHouseGetData(event:DataEvent) : void
        {
            GameProxy.guild.getGuildWarehouse();
            return;
        }// end function

        private function wareHouseApplyRequst(event:DataEvent) : void
        {
            GameProxy.guild.applyGuildWarehouse(event.data.uid, event.data.amount, event.data.donateMoney);
            return;
        }// end function

        private function wareHouseGetAllApplyList(event:DataEvent) : void
        {
            GameProxy.guild.getGuildWarehouseApplys();
            return;
        }// end function

        private function wareHouseGetMyApplyList(event:DataEvent) : void
        {
            GameProxy.guild.getMyWarehouseApplys();
            return;
        }// end function

        private function wareHouseApplyCancel(event:DataEvent) : void
        {
            GameProxy.guild.cancelApplyGuildWarehouse(event.data.uid, event.data.donateMoney);
            return;
        }// end function

        private function donateResourceShow(event:DataEvent) : void
        {
            if (!Cache.instance.guild.selfGuildInfo.selfHasJoinGuild)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71669));
                return;
            }
            var _loc_2:* = event.data as ItemData;
            if (_loc_2 == null)
            {
                return;
            }
            GuildDonateResource.item = _loc_2;
            GuildDonateResource.instance.donateNum = _loc_2.serverData.itemAmount;
            GuildDonateResource.instance.show();
            return;
        }// end function

        private function enterGuildCopyRequest(event:DataEvent) : void
        {
            CopyUtil.copyCheck(this.enterAfterCheck);
            return;
        }// end function

        private function enterAfterCheck() : void
        {
            GameProxy.copy.enterGuildCopy();
            return;
        }// end function

        private function openGuildCopyRequest(event:DataEvent) : void
        {
            GameProxy.guild.openGuildCopy(event.data as int);
            return;
        }// end function

        private function fixBuildingRequest(event:DataEvent) : void
        {
            GameProxy.guild.fixGuildStructure(event.data as EGuildStructureType);
            return;
        }// end function

        private function stopFixRequest(event:DataEvent) : void
        {
            GameProxy.guild.stopFixGuildStructure(event.data as EGuildStructureType);
            return;
        }// end function

        private function schoolLearnSkill(event:DataEvent) : void
        {
            GameProxy.guild.learnSchoolSkill(event.data as int);
            return;
        }// end function

        private function setWarnConditionRequest(event:DataEvent) : void
        {
            GameProxy.guild.setWarningCondition(event.data.days, event.data.activity, event.data.chatTimes, event.data.contributionWeek);
            return;
        }// end function

        private function getActivityRequest(event:DataEvent) : void
        {
            GameProxy.guild.getGuildActivity();
            return;
        }// end function

        private function sendGuildMail(event:DataEvent) : void
        {
            GameProxy.guild.sendGuildMail(event.data.toPlayerIds, event.data.title, event.data.content);
            return;
        }// end function

        private function setApplyCondition(event:DataEvent) : void
        {
            GameProxy.guild.setApplyCondition(event.data as SGuildApplyCondition);
            return;
        }// end function

        private function schoolOpen(event:DataEvent) : void
        {
            if (!(_view && _view is GuildNewModule))
            {
                _view = this.initView();
            }
            if (_view.isHide)
            {
                _view.show();
            }
            (_view as GuildNewModule).changeTab(6);
            return;
        }// end function

        private function wareHouseItemMenuClick(event:DataEvent) : void
        {
            var _loc_2:* = event.data.operate;
            var _loc_3:* = event.data.itemData as ItemData;
            GuildWareHouseApplyItem.instance.showPanel(_loc_3, _loc_2);
            return;
        }// end function

        private function changeGuildQQYY(event:DataEvent) : void
        {
            GameProxy.guild.changeYYQQ(event.data.operType, event.data.numStr);
            return;
        }// end function

        private function levelUpGuild(event:DataEvent) : void
        {
            GameProxy.guild.levelUpGuild();
            return;
        }// end function

        private function upgradeCampRequest(event:DataEvent) : void
        {
            GameProxy.guild.upgradeCamp(event.data as EUpgradeMode);
            return;
        }// end function

        private function getGuildList(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data);
            GameProxy.guild.getGuildList(_loc_2);
            return;
        }// end function

        private function guildMemberListUpdate(event:DataEvent) : void
        {
            if (_view != null && _view is GuildNewModule)
            {
                (_view as GuildNewModule).update();
            }
            return;
        }// end function

        private function newMemberAdd(param1:Object = null) : void
        {
            if (_view != null && _view is GuildNewModule)
            {
                (_view as GuildNewModule).update();
            }
            return;
        }// end function

        private function selfJionSuccess(param1:Object = null) : void
        {
            var _loc_3:String = null;
            var _loc_2:* = param1 as SJoinGuildInfo;
            if (_loc_2.type.value() == EJoinGuildType._EApplyJoinGuild)
            {
                if (_loc_2.dealResult == 0)
                {
                    MsgManager.showRollTipsMsg(Language.getStringByParam(71670, _loc_2.miniGuild.guildName));
                    return;
                }
                if (GuildListPanel.hasInstance && !GuildListPanel.instance.isHide)
                {
                    GuildListPanel.instance.hide();
                }
                _loc_3 = _loc_2.guildType == 0 ? ("" + Language.getString(71671)) : (Language.getString(71672));
                MsgManager.showRollTipsMsg(Language.getString(71673) + _loc_2.miniGuild.guildName + _loc_3);
                cache.guild.selfGuildInfo.setGuildID(_loc_2.miniGuild.guildId);
                GuildWelcomePanel.instance.show();
                GuildWelcomePanel.instance.setData(_loc_2.miniGuild);
                GameProxy.guild.getGuildMemberList(_loc_2.miniGuild.guildId);
            }
            else if (_loc_2.type.value() == EJoinGuildType._EInviteJoinGuild)
            {
                if (_loc_2.mode.value() == EInviteMode._EInviteForJoinGuild)
                {
                    if (_loc_2.dealResult == 0)
                    {
                        MsgManager.showRollTipsMsg(_loc_2.name + Language.getString(71675));
                        return;
                    }
                    MsgManager.showRollTipsMsg(_loc_2.name + Language.getString(71676));
                    if (cache.guild.otherGuildInfoV2.guildID != 0)
                    {
                        cache.guild.otherGuildInfoV2.removeMember(_loc_2.playerId);
                    }
                    if (!GuildFindTalentPanel.instance.isHide)
                    {
                        GuildFindTalentPanel.instance.update();
                    }
                    GameProxy.guild.getGuildMemberList(cache.guild.selfGuildInfo.guildID);
                }
                else if (_loc_2.mode.value() == EInviteMode._EInviteForCreateGuild)
                {
                    if (_loc_2.dealResult == 0)
                    {
                        MsgManager.showRollTipsMsg(_loc_2.name + Language.getString(71675));
                    }
                    else if (_loc_2.playerId == cache.role.playerInfo.playerId)
                    {
                        MsgManager.showRollTipsMsg(Language.getStringByParam(71677, _loc_2.miniGuild.guildName));
                    }
                    else
                    {
                        MsgManager.showRollTipsMsg(_loc_2.name + Language.getString(71678));
                    }
                }
            }
            return;
        }// end function

        private function selfPositionModify(param1:Object) : void
        {
            GuildHintIconMgr.instance.renIocn.show();
            return;
        }// end function

        private function wareHouseDataUpdate(param1:Object) : void
        {
            if (_view != null && _view is GuildNewModule)
            {
                (_view as GuildNewModule).update();
            }
            if (GuildWareHousePanel.hasInstance())
            {
                GuildWareHousePanel.instance.update();
            }
            return;
        }// end function

        private function WareHouseMyApplysUpdate(param1:Object) : void
        {
            if (GuildWareHouseMyApplyListPanel.hasInstance())
            {
                GuildWareHouseMyApplyListPanel.instance.update();
            }
            return;
        }// end function

        private function inviteResponse(param1:Object = null) : void
        {
            if (ClockManager.instance.serverOpenDateNum < 3)
            {
                return;
            }
            GuildHintIconMgr.instance.yaoIcon.show();
            return;
        }// end function

        private function onGuildInviteCreate(param1:Object) : void
        {
            GuildHintIconMgr.instance.huiIcon.show();
            GuildHintIconMgr.instance.huiIcon.inviter = param1 as SMiniPlayer;
            return;
        }// end function

        private function dealInvite(event:DataEvent) : void
        {
            GameProxy.guild.dealInvite(event.data.invitePlayerId, event.data.guildId, event.data.agree, event.data.type);
            return;
        }// end function

        private function inviteRequest(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data.id);
            var _loc_3:* = event.data.type as int;
            GameProxy.guild.invitePlayer(_loc_2, _loc_3);
            return;
        }// end function

        private function apply(event:DataEvent) : void
        {
            if (Cache.instance.guild.selfGuildInfo.selfInfo && GuildConst.hasPermissions(GuildConst.ApplyGuild))
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71679));
                return;
            }
            if (cache.role.roleInfo.level < GuildConst.CreateGuildRequireLevel)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71680));
                return;
            }
            var _loc_2:* = event.data.guildInfo as SMiniGuildInfo;
            if (_loc_2.playerNum == _loc_2.maxPlayerNum)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71681));
                return;
            }
            GameProxy.guild.applyGuild(_loc_2.guildId);
            return;
        }// end function

        private function applyByRole(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data);
            GameProxy.guild.applyPlayersGuild(_loc_2);
            return;
        }// end function

        private function dealApply(event:DataEvent) : void
        {
            if (event.data.agree == true && cache.guild.selfGuildInfo.memberListIsFull)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71682));
                return;
            }
            var _loc_2:* = cache.guild.selfGuildInfo;
            var _loc_3:* = event.data.handleAll;
            if (!_loc_3)
            {
                GameProxy.guild.dealApply(event.data.playerID, event.data.agree);
            }
            else
            {
                GameProxy.guild.dealApply(0, event.data.agree);
            }
            return;
        }// end function

        private function getApplyList(event:DataEvent) : void
        {
            GameProxy.guild.getApplyList(cache.guild.selfGuildInfo.guildID);
            return;
        }// end function

        private function UpdateFindtalentPanel(event:DataEvent) : void
        {
            if (!GuildFindTalentPanel.instance.isHide)
            {
                GuildFindTalentPanel.instance.update();
            }
            return;
        }// end function

        private function findtalent(event:DataEvent) : void
        {
            PlayerMenuConst.Opearte(PlayerMenuConst.GuildInvite, event.data);
            return;
        }// end function

        private function onGetActivityReward(event:DataEvent) : void
        {
            GameProxy.guild.getActivityReward();
            return;
        }// end function

        private function onGuildGetTreeBuff(event:DataEvent) : void
        {
            GameProxy.guild.getGuildTreeBuff(event.data as int);
            return;
        }// end function

        private function onGuildTaskDoubleRewardViewShow(event:DataEvent) : void
        {
            if (!Cache.instance.guild.hasGuild)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71683));
                return;
            }
            if (Cache.instance.role.roleInfo.level < 45)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71684));
                return;
            }
            var _loc_2:* = Cache.instance.task.getTaskInfoByGroup(ETaskGroup._ETaskGroupGuild);
            if (_loc_2 == null)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71685));
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.TaskGuildShowGetWin, _loc_2));
            return;
        }// end function

        private function applyListUpdate(param1:Object = null) : void
        {
            GuildApplyListPanel.instance.update();
            return;
        }// end function

        private function guildShopGetItem(event:DataEvent) : void
        {
            GameProxy.guild.getGuildShopItems();
            return;
        }// end function

        private function updateGuildShopItem(param1:Object) : void
        {
            if (!GuildShopPanel.instance.isHide)
            {
                GuildShopPanel.instance.updateShopItem();
            }
            return;
        }// end function

        private function onGuildCopyOpen(param1:Object) : void
        {
            if (GuildNewCopyPanel.hasInstance() && !GuildNewCopyPanel.instance.isHide)
            {
                GuildNewCopyPanel.instance.update();
            }
            GuildBossIcon.instance.show();
            GuildBossIcon.instance.playEffect();
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildActivityShow));
            this.checkActive();
            return;
        }// end function

        private function onGuildCopyClose(param1:Object) : void
        {
            if (GuildNewCopyPanel.hasInstance() && !GuildNewCopyPanel.instance.isHide)
            {
                GuildNewCopyPanel.instance.update();
            }
            GuildBossIcon.instance.stopEffect();
            GuildBossIcon.instance.hide();
            if (GuildNewCopyPanel.hasInstance() && GuildNewCopyPanel.instance.isHide == false)
            {
                GuildNewCopyPanel.instance.hide();
            }
            return;
        }// end function

        private function onGuildActivityUpdate(param1:Object) : void
        {
            if (GuildNewCopyPanel.hasInstance() && !GuildNewCopyPanel.instance.isHide)
            {
                GuildNewCopyPanel.instance.update();
            }
            return;
        }// end function

        private function onGuildMailSendSuccess(param1:Object) : void
        {
            if (GuildMailPanel.hasInstance() && !GuildMailPanel.instance.isHide)
            {
                GuildMailPanel.instance.hide();
            }
            Cache.instance.guild.selfGuildInfo.setGuildMailCD(GameConst.GuildSendMailInterval);
            return;
        }// end function

        private function onGuildApplyConditionUpdate(param1:Object) : void
        {
            if (GuildApplyConditionPanel.hasInstace() && !GuildApplyConditionPanel.instance.isHide)
            {
                GuildApplyConditionPanel.instance.update();
            }
            return;
        }// end function

        private function onGuildWarnListUpdate(param1:Object) : void
        {
            if (GuildWarnMembersPanel.hasInstance() && !GuildWarnMembersPanel.instance.isHide)
            {
                GuildWarnMembersPanel.instance.update();
            }
            return;
        }// end function

        private function onTaskGetSucess(param1:int) : void
        {
            if (param1 == GameConst.TFreeCreateGuildTaskCode)
            {
                if (GuildCreatePanel.hasInstance && !GuildCreatePanel.instance.isHide)
                {
                    GuildCreatePanel.instance.hide();
                }
                if (GuildListPanel.hasInstance && !GuildListPanel.instance.isHide)
                {
                    GuildListPanel.instance.hide();
                }
            }
            return;
        }// end function

        private function updateGardenInfo(param1:Object) : void
        {
            return;
        }// end function

        private function gotoGardenHd(event:DataEvent) : void
        {
            if (Cache.instance.guild.hasGuild == false)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71686));
                return;
            }
            CopyUtil.copyCheck(this.checkGo);
            return;
        }// end function

        private function checkGo() : void
        {
            if (!FlyBootAI.checkCanFly())
            {
                return;
            }
            GameController.guide.checkAndBuyFlyBoot(this.startFlyToGarden);
            return;
        }// end function

        private function startFlyToGarden() : void
        {
            var _loc_1:* = new SPassPoint();
            var _loc_2:* = Cache.instance.guild.selfGuildInfo.baseInfo.guildId;
            var _loc_3:* = Cache.instance.guild.curInsideGuildId;
            var _loc_4:* = new SPassTo();
            _loc_4.mapId = GuildNewUtil.GuildManorMapId;
            _loc_4.toPoint = new SPoint();
            _loc_4.toPoint.x = 6808;
            _loc_4.toPoint.y = 3495;
            AIManager.cancelAll();
            if (GuildNewUtil.GuildManorMapId == Game.mapInfo.mapId)
            {
                AIManager.addFlyBoot(_loc_4);
                AIManager.start();
            }
            else
            {
                _loc_1.type = PassAI.EnterGuildType;
                _loc_1.mapId = Cache.instance.guild.selfGuildInfo.baseInfo.guildId;
                AIManager.addPassToMap(_loc_1);
                AIManager.addFlyBoot(_loc_4);
                AIManager.start();
            }
            return;
        }// end function

        private function onGetOtherGuildMen(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            GameProxy.guild.getOtherGuildMemberList(_loc_2);
            return;
        }// end function

        private function onOtherMemInfoBack(param1:Object) : void
        {
            GuildNewOtherGMemWin.instance.updateMember();
            return;
        }// end function

    }
}
